<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>系统参数设置</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">


    <link rel="stylesheet" href="../../vendor/bootstrap/css/bootstrap.css">
    <link href="//cdn.bootcss.com/bootstrap-select/1.10.0/css/bootstrap-select.min.css" rel="stylesheet">
    <link rel="stylesheet" href="../../vendor/bootstrap/css/bootstrap-datetimepicker.min.css">


    <script src="//cdn.bootcss.com/moment.js/2.14.1/moment.min.js"></script>
    <script src="//cdn.bootcss.com/moment.js/2.14.1/locale/zh-cn.js"></script>
    <script src="../../vendor/jquery/jQuery-2.2.0.min.js"></script>
    <script src="../../vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap-select/1.10.0/js/bootstrap-select.min.js"></script>
    <script src="../../vendor/bootstrap/js/daterangepicker.js"></script>
    <script src="../../address-resolver.js"></script>
    <script src="../../vendor/vue/vue.min.js"></script>
</head>
<body>
<div id="app" class="container-fluid">
    <div class="form-group">
        <span>电费单价（元/千瓦时）：</span>
        <input type="text" class="form-control" placeholder="请输入电费单价" v-model="electPrice" aria-describedby="basic-addon1" value="{{electPrice}}" ><br><br>
    </div>

    <div class="form-group">
        <span>水费单价（元/吨）：</span>
        <input type="text" class="form-control" placeholder="请输入水费单价" v-model="waterPrice" aria-describedby="basic-addon1" value="{{waterPrice}}"> <br><br>
    </div>

    <div class="form-group">
        <span>网费单价（元/月）：</span>
        <input type="text" class="form-control" placeholder="请输入网费单价" v-model="netPrice" aria-describedby="basic-addon1" value="{{netPrice}}"><br><br>
    </div>
    <button type="submit" @click="submit" class="{{brand_button?'btn btn-default':'btn btn-default disabled' }}">提交</button>&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;
    <button type="submit" @click="cancel" class="{{brand_button?'btn btn-default':'btn btn-default disabled' }}">取消</button>
</div>

<script>//首先使用一个闭包,防止污染全局对象


(function () {

    var url=document.location.href;;
    console.log(url);
    var s= decodeURI(location.search);
    console.log(s);

    console.log(GetQueryString("username"));

    //定义页面的mvvm对象,用法参考 vuejs框架
    var vm = new Vue(
        {
            el: "#app",
            data: {
                electPrice:'',
                waterPrice:'',
                netPrice:'',
                userName:''
            },
            created: function () {

            },
            watch: {

            },
            methods: {
                submit:function(){
                  var data={
                      username:this.userName,
                      electPrice:this.electPrice,
                      waterPrice:this.waterPrice,
                      netPrice:this.netPrice
                  }
                    getSetting(data,function () {
                        window.location.href="../item.html";
                    })
                },
                cancel:function () {
                    window.location.href="../item.html";
                }

            }

        });


    function getSetting(param, cp){
        $.post("/sys/add", param, cp);
    }


})();
</script>

</body>
</html>